package com.go.where.family.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.family.dao.GroupDao;
import com.go.where.family.pojo.GroupInfo;
import com.go.where.family.service.GroupService;

@Service("groupService")
public class GroupServiceImpl implements GroupService {

	@Resource(name = "groupDao")
	private GroupDao groupDao;

	@Override
	public GroupInfo save(GroupInfo groupInfo) {
		groupInfo.setId(UUID.randomUUID().toString());
		groupInfo.setGroupTime(new Date());
		int re = groupDao.insert(groupInfo);
		if (re > 0) {
			return groupInfo;
		} else
			return null;
	}

	@Override
	public List<String> queryByCustomerId(String customerId) {
		return groupDao.queryByCustomerId(customerId);
	}

	@Override
	public List<GroupInfo> queryByParameters(Map<String, Object> map) {
		return groupDao.queryByParameters(map);
	}

	@Override
	public String getNextKey() {
		return groupDao.getNextKey();
	}

	@Override
	public GroupInfo queryByGroupId(GroupInfo groupInfo) {
		return groupDao.queryByGroupId(groupInfo);
	}

	@Override
	public List<GroupInfo> queryByActivityId(GroupInfo groupInfo) {
		return groupDao.queryByActivityId(groupInfo);
	}

	@Override
	public Integer queryCount(Map<String, Object> map) {
		return groupDao.queryCount(map);
	}

	@Override
	public List<String> queryCustomerIds(GroupInfo groupInfo) {
		return groupDao.queryCustomerIds(groupInfo);
	}

	@Override
	public int update(GroupInfo groupInfo) {
		return groupDao.update(groupInfo);
	}
	
	public Integer queryGroupTotalPerson(Map<String, Object> map){
		return groupDao.queryGroupTotalPerson(map);
	}

}
